package com.edu.comment.mapper;

import com.edu.api.entity.comment.CourseComment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.edu.api.entity.commentdto.CourseCommentDto;
import com.edu.api.entity.common.Pageable;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Entity com.edu.api.entity.comment.CourseComment
 */
@Repository
public interface CourseCommentMapper extends BaseMapper<CourseComment> {

    Integer saveOrCancelFavorite(@Param("commentId") String commentId,@Param("userId") String userId);

    /**
     * 查询文章留言
     * @param courseId
     * @param pageable
     * @return
     */
    List<CourseCommentDto> getCourseCommentList(@Param("courseId")String courseId, @Param("pageable") Pageable pageable);

    /**
     * 发表留言
     * @param courseId
     * @param userId
     * @param userName
     * @param comment
     * @return
     */
    int saveCourseComment(@Param("courseId") String courseId,@Param("userId") String userId,@Param("userName") String userName,@Param("comment") String comment);

    int updateCommentAndFavoriteRecord(@Param("recordId") Integer recordId,@Param("recordIsDel") Boolean recordIsDel);

}




